<?php 
/**
 * ERROR CODE 1000-1019
 *
 * */
class ADMIN_user
{
	private $error;
	private static $isLogined = -1;
	public function __construct() {
		$this->error = $GLOBALS['error'];
	}
	public function login($login,$password)
	{
		$user = new User();
		$ret = $user->login($login, $password);
		if( $ret === false ) {
			return false;
		}
		return $ret;
		
	}
	public function checkUser()
	{
		$this->isLogined = 0;
		$result = false;
		$user = new User();
		$res = $user->userGroup();
		if( $res == "admin" ) {
			$this->isLogined = 1; 
			$result = true;
		}
		return $result;
	}
	public function objrctID() {
		$objID = -1;
		if( $this->isLogined == -1 ) {
			$this->checkUser();
		}
		if( $this->isLogined == 0 ) {
			return $objID;
		}
		if( array_key_exists("object_id", $_SESSION) ) {
			$objID = (int)$_SESSION['object_id'];
		}
		return $objID;
	}
}

?>